package org.yoyo.classroom.security;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

public class CustomUserDetails extends User {
    private Long id;

    public CustomUserDetails(String username, String password, Collection<? extends GrantedAuthority> authorities, Long id) {
        super(username, password, authorities);
        this.id = id;
    }

    public Long getUserId() {
        return id;
    }
    @Override
    public String toString() {
        return "CustomUserDetails{" +
                "id=" + id +
                ", username='" + getUsername() + '\'' +
                ", password='" + getPassword() + '\'' +
                ", enabled=" + isEnabled() +
                ", accountNonExpired=" + isAccountNonExpired() +
                ", credentialsNonExpired=" + isCredentialsNonExpired() +
                ", accountNonLocked=" + isAccountNonLocked() +
                ", authorities=" + getAuthorities() +
                '}';
    }
}
